package com.bayihouse.model.entity;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.bayihouse.model.excel.publicClass.BaseOneEntity;
import com.bayihouse.model.excel.publicClass.father.BaseEntity;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.ToString;

import java.io.Serializable;
import java.util.Date;
import java.util.Objects;

/**
 * @TableName netobject
 */
@TableName(value = "netobject")
@Data
@AllArgsConstructor
@NoArgsConstructor
@ToString
public class Netobject extends BaseOneEntity<Community> implements Serializable {

    /**
     * 网格的业务,是小区,还是网点
     */
    private String detail;

    /**
     * 探针的数量
     */
    private Integer probeNum;

    /**
     *
     */
    private Date createTime;

    @TableField(exist = false)
    private static final long serialVersionUID = 1L;


    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        Netobject netobject = (Netobject) o;
        return Objects.equals(super.name, netobject.name);
    }

    @Override
    public int hashCode() {
        return Objects.hash(name);
    }

    @Override
    protected void setTId() {
        if (super.checkIsEmptyTList()) {
            return;
        }
        super.tlist.stream().forEach(child -> {
            child.setNetId(super.id);
        });
    }
}